package solution

import "math"

func V2(nums []int) int {
	max := nums[0]

	for from := 0; from < len(nums); from++ {
		sum := 0

		for to := from; to < len(nums); to++ {
			sum += nums[to]

			max = int(math.Max(float64(max), float64(sum)))
		}
	}

	return max
}